<template>
  <div class="home">
    
    <div class="search">
      <div><img src="../assets/图标/搜索.png" alt=""></div>
      <div><input type="text"></div>
      <div><router-link to="bookTown">书城</router-link><router-view></router-view></div>
    </div>
    <div class="img">
      <img src="../assets/images/首页.png" alt="">
    </div>
    <div class="hotList">
      <div><h3>本周热榜</h3> <div><p>换一换</p><img src="../assets/图标/换一换.png" alt=""></div></div>
      <storyBook />
    </div>
    <div class="hotList">
      <div><h3>潜力佳作</h3> <div><p>换一换</p><img src="../assets/图标/换一换.png" alt=""></div></div>
      <storyBook />
    </div>
    <div class="hotList">
      <div><h3>猜你喜欢</h3> <div><p>换一换</p><img src="../assets/图标/换一换.png" alt=""></div></div>
      <storyBook />
    </div>
    <div class="hotList">
      <div><h3>新书推荐</h3> <div><p>换一换</p><img src="../assets/图标/换一换.png" alt=""></div></div>
      <storyBook />
    </div>
    <div class="hotList">
      <div><h3>全网必看</h3> <div><p>换一换</p><img src="../assets/图标/换一换.png" alt=""></div></div>
      <storyBook />
    </div>

     <tabbar page="Home" />
  </div>
</template>

<script>
import {mapState,mapGetters,mapMutations,mapActions} from "vuex"
// npm i pubsub-js 下载并引入
import pubsub from "pubsub-js"
// npm i axios  全局安装axios 并引入
import axios from "axios"
import tabbar from "../components/tabbar.vue" 
import storyBook from "../components/storyBook.vue"

export default {
    name:"Home",
     components:{
      tabbar,
      storyBook
    },
    computed:{
    ...mapState("novel",["novel"]), //数组形式用key和value一致时
      ...mapGetters("novel",["novelList"])

    },
    created(){
      this.$store.commit('novel/getNovelList','')
      console.log(this.$store);
    },
    data() {
      return {
        
      }
    },
    methods:{
      ...mapMutations("novel",{getNovelList:'getNovelList'})

    }
}
</script>

<style scoped>
  *{
    margin: 0;
    padding: 0;
    letter-spacing: 1px;
  }
  .search{
    display: flex;
    width: 90%;
    margin: 10px auto;
    border-radius: 25px;
    background-color: #E4E4E4;
    justify-content: space-between;
    align-items: center;
    padding: 4px 15px;
  }
  .search div img{
    width: 30px;
    background-color: #E4E4E4;

  }
  .search div input{
    background-color: #E4E4E4;
    border: none;
    height: 30px;
    margin: 5px 0;
    width: 250px;
    outline: none;
    font-size: 20px;
    border-right: 1px solid #717171;

  }
  .search div a{
    color: #717171;
    text-decoration: none;
    padding-right: 5px;
    background-color: #E4E4E4;

  }
  .img{
    margin: 20px auto;
    transform: translateX(4px);
    /* background-color: #E4E4E4; */

  }
  .img img{
    width: 99%;
    height: 180px;
  }
  .hotList{
    width: 98%;
    margin: 0 auto;
    margin-bottom: 40px;
  }
  .hotList div:nth-child(1){
    width: 98%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .hotList div h3{
    padding-left: 10px;
    /* transform: translateX(5px); */
  }
  .hotList div div{
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .hotList div div img{
    width: 22px;
    margin-left: 10px;
  }
</style>